package de.szut.util;

/**
 * Serves as a return type for methods that are fallible.
 * Fallible methods often can either return only the resulting value OR if the operation succeeded.
 * This data loss is being solved by Fallible serving as a return type containing both, the value and the information if the operation succeeded.
 * @author Marc Huisinga
 *
 * @param <T> Type to store
 */
public final class Fallible<T> {
	
	private T content;
	private boolean succeeded;
	
	/**
	 * Constructor
	 * @param content - Content to store
	 * @param succeeded - Operation succeeded
	 */
	public Fallible(T content, boolean succeeded) {
		this.content = content;
		this.succeeded = succeeded;
	}

	/**
	 * Gets the content stored in Fallible
	 * @return content
	 */
	public T getContent() {
		return content;
	}

	/**
	 * Gets if the operation succeeded
	 * @return operation succeeded
	 */
	public boolean isSucceeded() {
		return succeeded;
	}
}
